﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data;

namespace LosConn.Web.Order
{
    public partial class OrderSupplementsAdd : System.Web.UI.Page
    {
        public String html = String.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                html = GetSupplementsHtml();
            }
        }

        private String GetSupplementsHtml()
        {
            BLL.Los_Product bllProduct = new BLL.Los_Product();
            StringBuilder sb = new StringBuilder(2000);
            sb.Append("<table class=\"table table-bordered table-striped table-hover with-check\">");
            DataTable dt = bllProduct.GetList(String.Format(" Product_TypeID={0} and Product_Status=100 ", 1)).Tables[0];
            sb.Append("<thead><tr><th></th><th>产品编码</th><th>产品名称</th><th>金额</th></tr></thead>");
            sb.Append("<tbody>");
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    sb.AppendFormat("<tr><td><input vid=\"type{0}\" value=\"{1}\" class=\"shopCheck\" type=\"checkbox\" /></td><td class=\"Product_Code\">{2}<input type=\"hidden\" class=\"Product_ID\" value=\"{1}\" /></td><td class=\"Product_Name\">{3}</td><td>{4}<input type=\"hidden\" class=\"Product_Money\" value=\"{4}\" /></td></tr>", 1, dr["Product_ID"], dr["Product_Code"], dr["Product_Name"], dr["Product_Price"]);
                }
            }
            else
            {
                sb.Append("<tr><td colspan=\"3\">暂无数据...</td></tr>");
            }
            sb.Append("</tbody>");
            sb.Append("</table>");
            return sb.ToString();
        }
    }
}